<?php
include_once("../includes/common.php");
include_once("../class/User.class.php");
require_once("../islogin.php");

if ($isadmin!=1){
    header('Location: /');
    exit;
}

$menuavatar = !$user_info["message"]["avatar"] ? "/data/avatar/default.jpg" : $user_info["message"]["avatar"];
$pageName = "Bot用户生成";

if(isset($_GET['num'])){
    $user->addBot($_GET['num']);

    $referrer = $_SERVER['HTTP_REFERER'];
    header("Location: $referrer");
    exit();
}
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>

    <?php require_once('head.php'); ?>

    <link rel="stylesheet" href="/static/css/message.css" />
</head>
<body>

<!--==================== Preloader Start ====================-->
<div class="preloader">
    <div class="loader"></div>
</div>
<!--==================== Preloader End ====================-->

<!--==================== Sidebar Overlay End ====================-->
<div class="side-overlay"></div>
<!--==================== Sidebar Overlay End ====================-->


<?php require_once('menu.php'); ?>
<div class="dashboard-main-wrapper">

    <?php require_once('top_navbar.php'); ?>
    <div class="dashboard-body">
        <!-- My Details Tab start -->
        <div class="tab-pane fade show active" id="pills-details" role="tabpanel" aria-labelledby="pills-details-tab" tabindex="0">
            <div class="card">
                <div class="card-header border-bottom">
                    <h4 class="mb-4"><?php echo $pageName?></h4>
                </div>
                <div class="card-body">
                    <form action="" method="get">
                        <div class="row gy-4">
                            <div class="col-sm-12 col-xs-12">
                                <label for="fname" class="form-label mb-8 h6">输入要生成的Bot数量</label>
                                <input type="number" required max="100" value="" name="num" class="form-control py-11" id="fname" placeholder="输入数量(最大100)">
                            </div>
                            <div class="col-12">
                                <div class="flex-align justify-content-end gap-8">
                                    <button type="submit" class="btn btn-main rounded-pill py-9">生成</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <!-- My Details Tab End -->

    </div>

    <?php require_once('footer.php'); ?>
</div>

<script src="/static/js/message.min.js"></script>
<?php require_once('foot.php'); ?>

</body>
</html>